//Copyright (c) 2010, Goodwine & Tibia ML
//Licensed under new BSD License


function staminaHourChange(hours, mins, premmy){
	if(hours.value >= 42){
		hours.value = 42;
		mins.value = 0;
		mins.disabled = true;
		premmy.disabled = true;
	}
	else if(hours.value < 0){
		hours.value = 0;
		mins.value = 0;
		mins.disabled = false;
		premmy.disabled = false;
	}
	else{
		mins.disabled = false;
		premmy.disabled = false;
	}
}

// Recall the stamina.
function recallStamina()
{
	stamina = loadStamina();
	setTimeout('recallStamina()', 1000*60*3);
	var form = document.getElementById('stamina_form');
	var staminaTime = calcStamina();
	form.hours.value = staminaTime.hours;
	if(staminaTime.hours < 42){
		form.mins.disabled = false;
		form.premmy.disabled = false;
		form.mins.value = staminaTime.mins;
		
	}
	form.premmy.checked = stamina.premmy;
}